﻿@{
    Layout = null;
}

<!DOCTYPE html>
@model ElingOA6_Admin_DSJCJ.Model.Leave
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>LeaveEdit</title>
        @if (false)
        {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
        } 
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PageCommon.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(
        new StyleSheet { ExtensionType = ExtensionType.ListBox }
    )
    @Html.DevExpress().GetScripts(
         new Script { ExtensionType = ExtensionType.ListBox }
    )
        @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme },
        new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }
)


<script>
    $(document).ready(function () {
        $("#toolMenu").smartFloat();
        var hdjsAlert = $("#hdjsAlert").val();
        if (hdjsAlert != "") {
            alert(hdjsAlert);
            if (hdjsAlert == "操作成功") {
                window.location.href = rootPath + "/Admin/LeaveAddition/Index?FClass=" + $("#hdFClass").val();
            }
        }
    });
        //员工选择确定
//        function EmpOK(id,name) {
//            $("#hbFEmplNo").val(id);
//            var clientFEmpNameObj = ASPxClientButtonEdit.Cast("FEmpName");
//            clientFEmpNameObj.SetText(name);
//            pcModalMode.Hide();
//        }

       function FEmplNo_ButtonClick(s, e) {
           var returnValue = window.showModalDialog(rootPath + "/Admin/Dialog/EmpLeaveAdditionTree", "选择人员", "dialogWidth=300px;dialogHeight=500px");
           if (typeof (returnValue) != "undefined") {
               var Value = JSON.parse(returnValue);
               if (Value.length != 0) {

                   $("#hbFEmplNo").val(Value[0].Value);
                   var clientFEmpNameObj = ASPxClientButtonEdit.Cast("FEmplName");
                   clientFEmpNameObj.SetText(Value[0].Text);
               }
           }
        }

        function save() {
            if (FReason.GetText() == "") {

                alert("详细原因必须填写！");

                return;
            }


            form1.submit();
        }

        function myCalendar(fmt) {
            WdatePicker({
                readOnly: true,
                dateFmt: fmt
            });
        }

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnSave":
                    {
                        //保存
                        save();
                        break;
                    }
                case "btnCancel":
                    {
                        //取消
                        window.location.href = rootPath + "/Admin/LeaveAddition/Index?FClass=" + $("#hdFClass").val();
                        break;
                    }
            }
        }

    </script>

</head>
<body>
@using (Html.BeginForm("Save", "LeaveAddition", FormMethod.Post, new { id = "form1" }))
{ 
        <div class="floatToolMenu" id="toolMenu">
            @Html.DevExpress().Menu(settings =>
       {
           settings.Name = "toolBarMenu";
           settings.ItemAutoWidth = false;
           settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
           settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
           settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

           settings.Items.Add(item =>
           {
               item.Name = "btnSave";
               item.Text = "保存";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

           });
           settings.Items.Add(item =>
           {
               item.Name = "btnCancel";
               item.Text = "取消";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

           });
           settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
           settings.ItemLinkMode = ItemLinkMode.ContentBounds;
       }).GetHtml()
      </div>
    <div>
    @if (ViewData["FClass"].ToString() == "1")
    {
        <table class="tableForm">
             <tr>
                <th>
                    人员:</th>
                <td class="tdClass">
           @Html.DevExpress().ButtonEdit(settings =>
      {
          settings.Text = Model.FEmplName;
          settings.Name = "FEmplName";
          settings.Width = 300;
          settings.ReadOnly = true;
          settings.Properties.Buttons.Add("选择");
          settings.Properties.ClientSideEvents.ButtonClick = "FEmplNo_ButtonClick";

          settings.Properties.ClientSideEvents.Validation = "function(s,e){notEmptyValidation(s,e,'对应员工')}";
      }).GetHtml()
                </td>
            </tr>

            <tr>
                <th>
                    请假原由:</th>
                <td class="tdClass">
          @Html.DevExpress().RadioButtonList(settings =>
     {
         settings.Name = "FLeaveReasonCd";
         settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
         settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
         settings.Properties.RepeatColumns = 2;
         settings.Properties.ValueField = "FLeaveReasonCd";
         settings.Properties.TextField = "FLeaveReasonName";
         settings.SelectedIndex = 0;
     }).BindList(ViewData["LeaveReasonList"]).Bind(Model.FLeaveReasonCd).GetHtml()
                </td>
            </tr>
            <tr>
                <th>
                    请假时间:</th> 
                <td class="tdClass">
                <table width="50%">
                <tr>
                <td style= " width:50%">
                @if (ViewData["hdMethod"] == "ADD")
                {
                    <input name="FBeginDate" id="FBeginDate" value="@DateTime.Now.ToString("yyyy-MM-dd")" onclick="myCalendar('yyyy-MM-dd')"  class="Wdate" style="width:120px" /> 
                  
                      @Html.Hidden("hdFBeginDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm"))
                }
                else
                {
                   <input name="FBeginDate" id="FBeginDate" value="@Model.FBeginDate.ToString("yyyy-MM-dd")" onclick="myCalendar('yyyy-MM-dd')"  class="Wdate" style="width:120px" /> 
                  
                      @Html.Hidden("hdFBeginDate", Model.FBeginDate.ToString("yyyy-MM-dd HH:mm"))
                }
                </td>
                <td>
                             @Html.DevExpress().ComboBox(settings =>
                        {
                            settings.Name = "BeginXZ";
                            settings.Properties.ValueField = "Value";
                            settings.Properties.TextField = "Text";
                            settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                            settings.Width = System.Web.UI.WebControls.Unit.Pixel(55);
                            settings.SelectedIndex = 0;
                            
                        }).BindList(new List<SelectListItem> { new SelectListItem { Text = "上午", Value = "am" }, new SelectListItem { Text = "下午", Value = "pm" } }).Bind(Model.BeginXZ).GetHtml()
                    </td>
                    </tr>
                    </table>
                    </td>

</tr>
            <tr>
            <th>至:</th>
                <td  class="tdClass">
                <table width="50%">
                <tr>
                <td style= " width:50%">
                 @if (ViewData["hdMethod"] == "ADD")
                 {
                        <input name="FEndDate" id="FEndDate" value="@DateTime.Now.ToString("yyyy-MM-dd")" onclick="myCalendar('yyyy-MM-dd')"  class="Wdate" style="width:120px" /> 
                 }
                 else
                 {
                        <input name="FEndDate" id="FEndDate2" value="@Model.FEndDate.ToString("yyyy-MM-dd")" onclick="myCalendar('yyyy-MM-dd')"  class="Wdate" style="width:120px" /> 
                 }
                </td>
                <td style= " width:20px">
       @Html.DevExpress().ComboBox(settings =>
  {
      settings.Name = "EndXZ";
      settings.Properties.ValueField = "Value";
      settings.Properties.TextField = "Text";
      settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
      settings.Width = System.Web.UI.WebControls.Unit.Pixel(55);
      settings.SelectedIndex = 0;
  }).BindList(new List<SelectListItem> { new SelectListItem { Text = "上午", Value = "am" }, new SelectListItem { Text = "下午", Value = "pm" } }).Bind(Model.EndXZ).GetHtml()
                </td>
                </tr>
                </table>
          </td>
            </tr>
            <tr>
                <th>
                    详细原因:</th>
                <td class="tdClass">
     @Html.DevExpress().Memo(settings =>
{
    settings.Name = "FReason";
    settings.Width = 500;
    settings.Text = Model.FReason;
}).GetHtml()
                 </td>
              </tr>
    </table>
    }
    else
    {
                 <table class="tableForm">
             <tr>
                <th>
                    人员:</th>
                <td class="tdClass">
           @Html.DevExpress().ButtonEdit(settings =>
      {
          settings.Text = Model.FEmplName;
          settings.Name = "FEmplName";
          settings.Width = 300;
          settings.ReadOnly = true;
          
          settings.Properties.Buttons.Add("选择");
          settings.Properties.ClientSideEvents.ButtonClick = "FEmplNo_ButtonClick";

          settings.Properties.ClientSideEvents.Validation = "function(s,e){notEmptyValidation(s,e,'对应员工')}";
      }).GetHtml()
                </td>
            </tr>

            <tr style="display:none">
                <th>
                    外出原由:</th>
                <td class="tdClass">
          @Html.DevExpress().RadioButtonList(settings =>
     {
         settings.Name = "FLeaveReasonCd";
         settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
         settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
         settings.Properties.RepeatColumns = 2;
         settings.Properties.ValueField = "FLeaveReasonCd";
         settings.Properties.TextField = "FLeaveReasonName";
         settings.SelectedIndex = 0;
     }).BindList(ViewData["LeaveReasonList"]).Bind(Model.FLeaveReasonCd).GetHtml()
                </td>
            </tr>
            <tr>
                <th>
                    外出时间:</th> 
            <td>
                @if (ViewData["hdMethod"] == "ADD")
                {
                     <input name="FBeginDate" id="FBeginDate" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" onclick="myCalendar('yyyy-MM-dd HH:mm')"  class="Wdate" style="width:120px" /> 
                 
                     @Html.Hidden("hdFBeginDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm"))
                }
                else
                {
                    <input name="FBeginDate" id="FBeginDate" value="@Model.FBeginDate.ToString("yyyy-MM-dd HH:mm")" onclick="myCalendar('yyyy-MM-dd HH:mm')"  class="Wdate" style="width:120px" /> 
                   
                     @Html.Hidden("hdFBeginDate", Model.FBeginDate.ToString("yyyy-MM-dd HH:mm"))
                }
     
                    </td>

</tr>
            <tr style="display:none">
            <th>预计返回时间:</th>
       <td>
                 @if (ViewData["hdMethod"] == "ADD")
                 {
                        <input name="FEndDate" id="FEndDate" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" onclick="myCalendar('yyyy-MM-dd HH:mm')"  class="Wdate" style="width:120px" /> 
                 }
                 else
                 {
                        <input name="FEndDate" id="FEndDate2" value="@Model.FEndDate.ToString("yyyy-MM-dd HH:mm")" onclick="myCalendar('yyyy-MM-dd HH:mm')"  class="Wdate" style="width:120px" /> 
                 }
           
          </td>
            </tr>
            <tr>
                <th>
                    详细原因:</th>
                <td class="tdClass">
     @Html.DevExpress().Memo(settings =>
{
    settings.Name = "FReason";
    settings.Width = 500;
    settings.Text = Model.FReason;
}).GetHtml()
                 </td>
              </tr>
              <tr>
                <th>审核情况:</th>
                <td class="tdClass">
                    @Html.DevExpress().RadioButtonList(settings =>
               {
                   settings.Name = "FAuditNote";
                   settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
                   settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                   settings.Properties.Style.Border.BorderWidth = 0;
                   settings.Properties.RepeatColumns = 3;
                   settings.ControlStyle.CssClass = "left";
                   settings.ReadOnly = true;
               }).BindList(new List<SelectListItem>(){
                            new SelectListItem(){ Value="Y", Text="通过"} ,
                             new SelectListItem(){ Value="N", Text="未通过"},
                             new SelectListItem(){ Value="", Text="待审核"}, 
                                }).Bind(string.IsNullOrEmpty(Model.FAuditNote) ? "" : Model.FAuditNote).GetHtml()
                </td>
              </tr>
    </table>
    }
        @Html.Hidden("hdMethod", ViewData["hdMethod"])
        @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]))          
        @Html.Hidden("hdFClass", ViewData["FClass"])                                 
        @Html.Hidden("FLeaveID", Model.FLeaveID)
        @Html.Hidden("hbFEmplNo", Model.FEmplNo)
        @Html.Hidden("FDeptNo", Model.FDeptNo)
        
    </div>
}
</body>
</html>
